feat(memtrack): support disabling allocator tracking - #469
Merged
Conversation
Greptile SummaryAdds an allocator-tracking toggle for memtrack.
Confidence Score: 5/5The PR appears safe to merge because no blocking failures eligible for this follow-up review remain. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/memtrack/src/ebpf/tracker.rs | Adds environment-backed tracker options and conditionally starts allocator discovery machinery. |
| crates/memtrack/src/ebpf/memtrack/tracking.rs | Attaches mmap, munmap, and brk syscall tracepoints for every memory-tracking run. |
| crates/memtrack/tests/c_tests.rs | Verifies that disabling allocator tracking retains mmap events while suppressing allocator events. |
| crates/memtrack/tests/shared.rs | Adds option-based test helpers and limits allocation snapshots to deterministic allocator events. |
| crates/memtrack/Cargo.toml | Adds typed-builder for constructing tracker options. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Create Tracker] --> B[Attach lifecycle and memory syscall tracepoints]
B --> C{Allocator tracking enabled?}
C -->|Yes| D[Attach executable-mapping watcher]
D --> E[Start allocator attach worker]
C -->|No| F[Skip watcher and attach worker]
E --> G[Collect allocator and mmap/munmap/brk events]
F --> H[Collect mmap/munmap/brk events only]
Reviews (5): Last reviewed commit: "feat: add --track-allocators toggle for ..." | Re-trigger Greptile
Merging this PR will not alter performance
|
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
2 times, most recently
from
July 24, 2026 10:40
d983261 to
131f8a3
Compare
not-matthias
changed the base branch from
main
to
cod-3089-collect-rss-in-memtrack
July 24, 2026 12:04
GuillaumeLagrange
left a comment
Contributor
There was a problem hiding this comment.
I'm not sure what's really the usecase of this? olgtm but I'm not sure we've discussed
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
2 times, most recently
from
July 30, 2026 10:48
f1dbc8a to
efc66c8
Compare
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
from
July 30, 2026 12:40
7e96222 to
bdd0455
Compare
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
from
July 30, 2026 15:35
bdd0455 to
e158870
Compare
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
from
August 20, 2026 08:25
e158870 to
bbff5ff
Compare
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
from
August 24, 2026 12:34
bbff5ff to
0a48795
Compare
GuillaumeLagrange
approved these changes
Aug 28, 2026
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
3 times, most recently
from
August 28, 2026 16:57
2cdf777 to
5ef554a
Compare
Add a --track-allocators flag (default on, env CODSPEED_TRACK_ALLOCATORS) to the memtrack track subcommand. When disabled, memtrack skips the allocator uprobe machinery (exec watcher + attach worker) and only emits coarse mmap/munmap/brk events, reducing overhead on allocation-heavy programs. The mmap/munmap/brk syscall tracepoints are now always attached in every memory run. The runner does not add a CLI flag for this: it relies on the CODSPEED_TRACK_ALLOCATORS environment variable being inherited by the memtrack subprocess, keeping the runner decoupled from the installed memtrack version. Standalone memtrack can still use the CLI flag.
not-matthias
force-pushed
the
cod-3231-support-disabling-allocator-tracking
branch
from
August 28, 2026 17:46
5ef554a to
6ecb3c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
memtrack track --track-allocators(default on, envCODSPEED_TRACK_ALLOCATORS). When disabled, memtrack skips the allocator uprobe machinery and only emits coarsemmap/munmap/brkevents.Why
Allocation-heavy programs (e.g. a Rust build) generate an overwhelming number of
malloc/freeevents, and the per-allocation uprobes slow the target significantly. This trades allocation granularity for lower overhead while still collecting RSS-relevant memory events.How
mmap/munmap/brksyscall tracepoints are now always attached in a memory run.